home *** CD-ROM | disk | FTP | other *** search
- 1: /*
- 2: * Listing 1:
- 3: *
- 4: * Get login ID of current user.
- 5: * This is a standard QNX library function.
- 6: */
- 7:
- 8: #include <stdio.h> /* Standard FILE definitions */
- 9: #include <systids.h> /* Kernel task ID's */
- 10: #include <task_msgs.h> /* Kernel message structures */
- 11:
- 12: extern char Team_num; /* Accounting group number */
- 13:
- 14: char *cuserid( ustr )
- 15: char *ustr;
- 16: {
- 17: struct ta_account tsk_msg;
- 18: static char userid[17];
- 19:
- 20: /* Message for TASK_ADMIN */
- 21: tsk_msg.msg_type = TA_GET_ACCOUNT;
- 22:
- 23: /* ID of task group */
- 24: tsk_msg.accteam = Team_num;
- 25:
- 26: /* Send message to TASK_ADMIN to get account info. */
- 27: send( TASK_ADMIN, &tsk_msg, &tsk_msg,
- 28: sizeof(struct ta_account));
- 29:
- 30: /* Copy returned user ID to static variable */
- 31: strcpy( userid, tsk_msg.account_data.account_name );
- 32:
- 33: /* Return userid */
- 34: return((ustr != NULL) ? strcpy( ustr, userid ) : userid);
- 35: }
- 36:
-